package arch.dao.impl.user;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.BatchPreparedStatementSetter;

import arch.domain.user.relation.UserRole;
/**
 * 
 * @author ZhaoWangLong Sep 11, 2012
 *
 */
public class UserRoleBatchDeleteSetter implements BatchPreparedStatementSetter {
	private List<UserRole> userRoles;
	
	public UserRoleBatchDeleteSetter(List<UserRole> userRoles){
		this.userRoles = userRoles;
	}
	public int getBatchSize() {
		return userRoles.size();
	}

	public void setValues(PreparedStatement ps, int i) throws SQLException {
		ps.setString(1, userRoles.get(i).getRole().getRoleId());
		ps.setString(2, userRoles.get(i).getUser().getUserId());
	}

}
